let debug: boolean = window.location.href.includes("localhost") ? true : false;

window['bfdebug'] = function (bool) {
  debug = !!bool;
};

interface Console {
  log(...args: any[]): void,

  warn(...args: any[]): void,

  error(...args: any[]): void
}

class BfConsole implements Console {
  log(...args: any[]) {
    if (debug) {
      window.console.log(...args);
    }
  }

  warn(...args: any[]) {
    if (debug) {
      window.console.warn(...args);
    }
  }

  error(...args: any[]) {
    if (debug) {
      window.console.error(...args);
    }
  }
}

export default new BfConsole();
